package com.scuec.groupfive.service.impl;

import com.scuec.groupfive.entity.ExamStatistics;
import com.scuec.groupfive.mapper.ExamStatisticsMapper;
import com.scuec.groupfive.service.ExamStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ExamStatisticsServiceImpl implements ExamStatisticsService {

    @Autowired
    private ExamStatisticsMapper examStatisticsMapper;

    @Override
    public List<ExamStatistics> getExamStatistics(String timeDimension) {
        switch (timeDimension.toLowerCase()) {
            case "day":
                return examStatisticsMapper.getDailyStatistics();
            case "week":
                return examStatisticsMapper.getWeeklyStatistics();
            case "month":
                return examStatisticsMapper.getMonthlyStatistics();
            case "year":
                return examStatisticsMapper.getYearlyStatistics();
            default:
                throw new IllegalArgumentException("Invalid time dimension. Supported values: day, week, month, year");
        }
    }
}